<template>
  <div class="userData-wrap">
    <van-nav-bar left-text="个人资料" left-arrow @click-left="$router.back()" />
    <van-cell-group class="center">
      <van-cell title="头像：">
        <!-- <div class="user"> -->
        <template #right-icon>
          <van-icon
            name="https://b.yzcdn.cn/vant/icon-demo-1126.png"
            class="icon-user"
          />
        </template>
        <!-- </div> -->
      </van-cell>
      <van-cell title="姓名：" />
      <van-cell title="性别：">
        <van-icon slot="default"
          ><van-icon name="arrow-down" @click="show = true" />
          {{ sex }}
        </van-icon>
        <div slot="default">
          <van-action-sheet
            v-model="show"
            :actions="actions"
            @select="onSelect"
          />
        </div>
      </van-cell>
      <van-cell title="手机号码：" />
      <van-cell title="服务区域：">
        {{ site }}
        <van-icon slot="default"><van-icon name="arrow-down" /> </van-icon>
        <!-- <van-area slot="default" title="标题" :area-list="areaList" /> -->
      </van-cell>
      <van-cell title="详细地址：" />
      <van-cell title="手机验证码：">
        <div slot="default" class="verify-code">获取验证码</div>
      </van-cell>
    </van-cell-group>
    <div class="save">保存</div>
  </div>
</template>

<script>
export default {
  name: "userData",
  data() {
    return {
      show: false,
      actions: [{ name: "男" }, { name: "女" }],
      sex: "男",
      site: "湖南省长沙市岳麓区",
    };
  },
  props: {},
  created() {},
  methods: {
    onSelect(item) {
      // 默认情况下点击选项时不会自动收起
      // 可以通过 close-on-click-action 属性开启自动收起
      this.show = false;
      this.sex = item.name;
    },
  },
};
</script>

<style scoped lang="less">
.userData-wrap {
  /deep/.van-nav-bar__content {
    height: 64px;
    width: 100%;
    background: #3f51b5;
    i.van-icon {
      color: #fff;
      font-size: 16px;
    }
    span.van-nav-bar__text {
      color: #fff;
      font-size: 16px;
    }
  }
  .center {
    .van-cell:first-child {
      height: 84px;
      line-height: 64px;
    }
    .van-cell {
      height: 50px;
    }
    .icon-user {
      width: 55px;
      height: 54px;
      display: block;
      border-radius: 50%;
      background: #eeecec;
      display: flex;
      justify-content: center;
      align-items: center;
      img {
        display: block;
        font-size: 26px;
      }
    }
    .verify-code {
      width: 100px;
      height: 25px;
      background: #3f51b5;
      color: #fff;
      font-size: 12px;
      float: right;
      text-align: center;
      line-height: 25px;
    }
  }
  .save{
    width: 100%;
    height: 49px;
    background: #3F51B5;
    position: absolute;
    bottom: 0;
    color: #fff;
    font-size: 14px;
    line-height: 49px;
    text-align: center;
  }
}
</style>
